package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.api.dto.ProductSkuVo;
import com.spzx.product.api.dto.SkuLockVo;
import com.spzx.product.api.dto.SkuPriceVo;
import com.spzx.product.api.factory.RemoteProductFallbackFactory;
import com.spzx.product.api.factory.RemoteSkuStockFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * we put all feign invoke in the api modules ,if you need feign, dependence this module
 */
@FeignClient(
        contextId = "remoteSkuStockService",
        value = ServiceNameConstants.PRODUCT_SERVICE,
        fallbackFactory = RemoteSkuStockFallbackFactory.class
)
public interface RemoteSkuStockService {//叫 ProductClient也行

    @PostMapping("/checkAndLock/{orderNo}")
     R<String> checkAndLock(@PathVariable String orderNo,
                                  @RequestBody List<SkuLockVo> skuLockVoList,
                                  @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
